#!/bin/bash
set -e
set -u
set -o pipefail

function check-and-download() {
	remote_file=$1
	local_file=$2
	timeout -s INT 300 wget ${WGET_OPTIONS:-} -q -N -O ${local_file} ${remote_file} || {
		rm ${local_file}
		return 1
	}
	return
}

function dir-not-empty() {
	local dir=$1
	[[ ! -d "$dir" ]] && return 1
	nfiles=$(ls -a "$dir" | wc -l)
	if (( ${nfiles} > 2 )); then
		return 0
	fi
	return 1
}

LOADED_HELPERS="yes"

